<template>
	<div class="c1">
		<h1>我是Child1组件</h1>
		<h3>我的电脑是：{{computer}}</h3>
		<button @click="handleClick">把电脑给我父亲</button>
	</div>
</template>

<script>
	export default {
		name:'Child1',
		data() {
			return {
				computer:'联想Y9000P'
			}
		},
		methods:{
			handleClick(){
				this.$bus.$emit('get-computer',this.computer)
			}
		},
		mounted(){
			console.log('Child1')
			this.$bus.$emit('get-computer',this.computer)
		}
	}
</script>

<style>
	.c1{
		background-color: skyblue;
		padding: 20px;
	}
</style>